import 'package:flutter/material.dart'; // fim简便写法
import 'res/listData.dart';

void main() {
  runApp(MyApp());
}

// 基本结构
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('container  text')),
        body: HomeContent(),
      ),
    );
  }
}

class HomeContent extends StatelessWidget {
  // 01 Expanded 组件
  // @override
  // Widget build(BuildContext context) {
  //   // return IconContainer(Icons.search, color: Colors.blue);
  //   return Row(
  //     children: <Widget>[
  //       Expanded(
  //         flex: 1,
  //         child: IconContainer(Icons.search, color: Colors.blue),
  //       ),
  //       Expanded(
  //         child: IconContainer(Icons.home, color: Colors.orange),
  //       ),
  //       // Expanded(
  //       //   flex: 1,
  //       //   child: IconContainer(Icons.select_all, color: Colors.red),
  //       // )
  //     ],
  //   );
  // }

  // 02 布局左 右(上下)
  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        // Container(
        //   height: 180,
        //   color: Colors.blue,
        //   child: Text('你好Flutter'),
        // ),
        Row(
          children: <Widget>[
            Expanded(
              child: Container(
                height: 180,
                color: Colors.blue,
                child: Text('你好Flutter'),
              ),
            )
          ],
        ),
        SizedBox(height: 10),
        Row(
          children: <Widget>[
            Expanded(
                flex: 2,
                child: Container(
                  height: 180.0,
                  child: Image.network(
                      "https://images.weserv.nl/?url=img1.doubanio.com/view/photo/m/public/p2636695009.webp",
                      fit: BoxFit.cover),
                )),
            SizedBox(width: 10),
            Expanded(
                flex: 1,
                child: Container(
                    height: 180.0,
                    child: ListView(
                      children: <Widget>[
                        Container(
                          height: 85,
                          child: Image.network(
                              "https://images.weserv.nl/?url=img1.doubanio.com/view/photo/m/public/p2636695009.webp",
                              fit: BoxFit.cover),
                        ),
                        SizedBox(height: 10),
                        Container(
                          height: 85,
                          child: Image.network(
                              "https://images.weserv.nl/?url=img1.doubanio.com/view/photo/m/public/p2636695009.webp",
                              fit: BoxFit.cover),
                        ),
                      ],
                    )))
          ],
        )
      ],
    );
  }
}

// 01
// class IconContainer extends StatelessWidget {
//   double size = 32.0;
//   Color color = Colors.red;
//   IconData icon;
//   IconContainer(this.icon, {this.color, this.size});
//   @override
//   Widget build(BuildContext context) {
//     return Container(
//       height: 100.0,
//       width: 100.0,
//       color: this.color,
//       child: Center(
//         child: Icon(
//           this.icon,
//           size: this.size,
//           color: Colors.white,
//         ),
//       ),
//     );
//   }
// }
